﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;
using System.Data;
using System.Data.Common;
using System.Data.SqlClient;
using System.Data.SqlTypes;
using System.Collections;


namespace Data.Database
{
   public class HorarioLaboral
    {
        static private String cadenaConexion = ConfigurationManager.ConnectionStrings["Turnet"].ConnectionString; // @"Data Source=|DataDirectory|\BBDD.sdf";
        static private String nombreTabla = "HorarioLaboral";



        public DataSet ObtenerDiasLaborales()
        {
            DataSet dsDiasLaborales = new DataSet();
            try
            {
                SqlConnection conexion = new SqlConnection(cadenaConexion);
                {
                    String consulta = "Select * FROM DiaHorarioLaboral";
                    SqlDataAdapter daDL = new SqlDataAdapter(consulta, conexion);
                    daDL.MissingSchemaAction = MissingSchemaAction.AddWithKey;
                    daDL.Fill(dsDiasLaborales, "DiaHorarioLaboral"); //dsPersonal es ahora nuestra base de datos local
                }
            }
            catch (Exception ex)
            {
                throw (ex);
            }
            return dsDiasLaborales;
        }


        public DataSet ObtenerHorariosLaborales()
        {
            DataSet dsHorLab = new DataSet();
            try
            {
                SqlConnection conexion = new SqlConnection(cadenaConexion);
                {
                    String consulta = "Select Nombre FROM HorarioLaboral";
                    SqlDataAdapter daDL = new SqlDataAdapter(consulta, conexion);
                    daDL.MissingSchemaAction = MissingSchemaAction.AddWithKey;
                    daDL.Fill(dsHorLab, "HorarioLaboral"); //dsPersonal es ahora nuestra base de datos local
                }
            }
            catch (Exception ex)
            {
                throw (ex);
            }
            return dsHorLab;
        }

        public DataSet ObtenerIdHorarioLaboral(string horario)
        {
            DataSet dsHL = new DataSet();
            try
            {
                SqlConnection conexion = new SqlConnection(cadenaConexion);
                {
                    String consulta = "Select * FROM HorarioLaboral Where Nombre='" + horario + "'";
                    SqlDataAdapter daDL = new SqlDataAdapter(consulta, conexion);
                    daDL.MissingSchemaAction = MissingSchemaAction.AddWithKey;
                    daDL.Fill(dsHL, "HorarioLaboral");
                }
            }
            catch (Exception ex)
            {
                throw (ex);
            }
            return dsHL;








        }


    }
   }
